<%= render layout: "layouts/decidim/shared/layout_user_profile" do %>
  <% add_decidim_page_title(t("delete_my_account", scope: "layouts.decidim.user_profile")) %>
  <% content_for(:subtitle) { t("delete_my_account", scope: "layouts.decidim.user_profile") } %>

  <%= cell("decidim/announcement", t("alert", scope:"decidim.account.delete"), callout_class: "alert") %>
  <% if has_authorizations? %>
    <%= cell("decidim/announcement", t("leaving_authorizations_behind", scope:"decidim.account.delete"), callout_class: "alert") %>
  <% end %>

  <p class="help-text">
    <%= t("explanation", scope:"decidim.account.delete") %>
  </p>
  <%= decidim_form_for(@form, url: account_path, method: :delete, namespace: "delete_user", data: { controller: "delete-account-form" }, html: { class: "form-defaults delete-account" }) do |f| %>
    <div class="form__wrapper">
      <label>
        <%= f.text_area :delete_reason, rows: 2, label: false, help_text: t("activemodel.attributes.account.delete_reason") %>
      </label>
    </div>
    <div class="form__wrapper-block">
      <button type="button" data-dialog-open="delete-account" class="button button__sm md:button__lg button__secondary mr-auto !ml-0 open-modal-button">
        <%= t("title", scope:"decidim.account.delete.confirm") %>
      </button>
    </div>
  <% end %>
  <%= render partial: "delete_modal" %>
<% end %>
